#pragma once

#include "ColligereAudioDatabaseHandler.hpp"

namespace col
{

class SearchDiscogs
{
public:
	SearchDiscogs();
	SearchDiscogs ( const wxString &rTerm );

	class SearchResult
	{
	public:
		SearchResult();
		SearchResult ( const wxString &rTitle, const wxString &rUri ) ;

		const wxString &GetTitle() const;
		const wxString &GetUri() const;
	private:
		wxString mTitle, mUri;
	};

	typedef std::deque < SearchResult > SearchResultDeque;

	SearchResultDeque Search();
	Artist DownloadResult ( const SearchResult &rResult );

	void SetTerm ( const wxString &rTerm );

	static const wxString GetServerAddress();
private:
	long ParseSearchResults ( const wxString &rFromData, SearchResultDeque &rTo );
	Artist ParseDatabaseItem ( const wxString &rFromData );

	wxString mSearchTerm;
};

}